package com.labmi.experiment;

import java.io.Serializable;

import javax.faces.convert.LongConverter;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * 
 * Composite key for ItemStock class.
 * 
 * The primary key for this class is composed of 3 elements
 *
 */
@Embeddable
public class ItemStockID implements Serializable {

	
	private String itemCode;
	
	private String size;
	
	private String color;
	
	public ItemStockID() {	}
	
	public ItemStockID(String size, String color) {
		this.size 		= size;
		this.color 	  	= color;
		
	}
	
	public String getSize() {
		return size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	@Override
	public boolean equals(Object o) {
		if(o instanceof ItemStockID)
		{
			return 
				this.color.equals(((ItemStockID) o).getColor())
				&&
				this.size.equals(((ItemStockID) o).getSize())
				&&
				this.getItemCode() == ((ItemStockID) o).getItemCode();
		}
		
		
		return false;
		
	}
	
	@Override
	public int hashCode() {
		return color.hashCode() + size.hashCode() + getItemCode().hashCode();
	}

	public void setItemCode(String itemCode) {
		this.itemCode = itemCode;
	}

	public String getItemCode() {
		return itemCode;
	}

	
	
}
